Add --python-executable and --no-infer-executable flags#4692
Add --python-executable and --no-infer-executable flags#4692emmatyping wants to merge 6 commits intopython:masterfrom
Conversation
|
This should be ready for review now. I think the testing I have exercises the new flags well. |
| will attempt to find a Python executable of the corresponding version. If | ||
| you'd like to disable this, see ``--no-infer-executable`` below. | ||
|
|
||
| - ``--no-infer-executable`` will disable searching for a usable Python |
There was a problem hiding this comment.
I don't think this flag makes any sense without PEP561, and that --no-site-packages was a better name in that scenario, as it indicated the purpose of the executable
There was a problem hiding this comment.
Hm, I think I might agree in principle with the first (but I split this out for ease of review mostly).
As for the flag name, I'm not so sure. If the executable is ever used for anything other than PEP 561, the --no-site-packages flag would be misleading. It is misleading now anyway, it doesn't actually disable searching, it sets options.python_executable to None, which happens to mean that searching for PEP 561 packages is not done.
There was a problem hiding this comment.
it sets options.python_executable to None, which happens to mean that searching for PEP 561 packages is not done.
You've got this backwards. options.python_executable is None is an implementation-detail of how we represent "don't do pep561 searching", chosen over storing a redundant boolean alongside it. We could add a @property def do_pep561_searching to Options to make that more explicit, I suppose.
We shouldn't be exposing that detail in the command line arguments.
There was a problem hiding this comment.
Hm, I suppose from a user perspective it would be better to name it --no-site-packages.
|
Closing as this should be part of the main PEP implementation. |
This implements a flag that allows users to point to a Python interpreter that mypy can use for type checking.
--no-infer-executableis named as such because the old name (--no-site-packages) was rather misleading.Fixes #965
Carried over from #4403, with some changes (renaming the flag, documentation).